package com.compty.paint.domain;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 图片类，blob类型
 * @author zhuqh
 */
@Entity
@Table(name = "t_imageinfo")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class ImageInfo implements Serializable {

	private static final long serialVersionUID = 5568320267228507505L;
	
	private Long id;
	
	/************ 原始名称  ****************/
	private String originalName;
	
	private String newNameUploaded;//上传后的名字
	
	/************ 图片  ****************/
	private PhotoData photo;
	
	/************ 后缀 ****************/
	private String suffix;
	
	/************ 形状  ****************/
	private Long sharpId; 
	/* sharpId 1:表示正方形 2：表示长方形(竖),3：表示长方形(横),4：表示长卷(横披),5:长卷(立轴),6:表示头像,7:表示展览海报
	 * 8:表示背景摆设  9:表示画廊logo 10:表示拍卖画册封面*/
	
	/************ 备注 ****************/
	private String memo;


	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "originalname", length = 100)
	public String getOriginalName() {
		return originalName;
	}

	public void setOriginalName(String originalName) {
		this.originalName = originalName;
	}

	@OneToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY)
	@JoinColumn(name="photo_data_id")
	public PhotoData getPhoto() {
		return photo;
	}

	public void setPhoto(PhotoData photo) {
		this.photo = photo;
	}

	@Column(name = "suffix", length = 20)
	public String getSuffix() {
		return suffix;
	}

	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}

	@Column(name = "sharp_id")
	public Long getSharpId() {
		return sharpId;
	}

	public void setSharpId(Long sharpId) {
		this.sharpId = sharpId;
	}

	@Column(name = "memo")
	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	@Column(name = "newname_uploaded", length = 100)
	public String getNewNameUploaded() {
		return newNameUploaded;
	}

	public void setNewNameUploaded(String newNameUploaded) {
		this.newNameUploaded = newNameUploaded;
	}
	
}
